package com.sanmu.Test;

import com.sanmu.bean.Monster;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class beanTest {
    @Test
    public void getMonster(){
        ClassPathXmlApplicationContext ioc = new ClassPathXmlApplicationContext("beans.xml");
        Monster monster = (Monster) ioc.getBean("monster01");
        System.out.println(monster);
        Monster monster2 = ioc.getBean("monster02", Monster.class);
        System.out.println(monster2);

        String[] beanDefinitionNames = ioc.getBeanDefinitionNames();
        for (String beanDefinitionName : beanDefinitionNames) {
            System.out.println(beanDefinitionName);
        }

    }
}
